import unittest
from pyurl import File, Folder, URL
from pyurl.connection import Connection

class IterFolderTests(unittest.TestCase):
    def test_simple_iteration(self):
        url = URL(self.test_root, "folder_iter_test/")
        folder = Folder(url)
        expect_list = [URL(url, 'a'), URL(url, 'b')]
        for file in folder.get_children():
            self.failIf(file not in expect_list, "Folder iteration returned an unexpected file")
            expect_list.remove(file)
        self.failIf(len(expect_list) >0, "Folder iteration did not returned all expected files")
            

 